package com.tssup.fesco.util.mdc;

import java.util.concurrent.ThreadLocalRandom;

public class TraceIdGenerator {
    public static final String DEFAULT_TRACE_ID_PREFIX = "000000";

    public TraceIdGenerator() {
    }

    public static String create(Object id) {
        if(id == null) {
            id = "000000";
        }

        Long utc = Long.valueOf(System.currentTimeMillis());
        Integer random = Integer.valueOf(ThreadLocalRandom.current().nextInt());
        String traceId = "" + id + utc + Math.abs(random.intValue());
        return traceId;
    }
}